/*--------------------------------------------------------------------------
    This source file is part of Abraxas Game Engine
    For the latest info, see http://code.google.com/abraxasge/
    Copyright (C) 2009, Andrew LeRoy <aleroy@member.igda.org>
    ---

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA  02110-1301, USA.
--------------------------------------------------------------------------*/
#ifndef _Abx_PluginManager_hpp_
#define _Abx_PluginManager_hpp_

#include "AbxPrerequisites.hpp"
#include "AbxLongevity.hpp"
#include <loki/Singleton.h>

namespace Abx
{
    typedef unsigned int uint32;

    class _AbxExport PluginManagerImpl  //: public DynLibAlloc
    {
      public:
        PluginManagerImpl();
        virtual ~PluginManagerImpl();

        DynamicLibrary* load(const String& filename);
        void unload(DynamicLibrary* lib);
        
      protected:
        typedef std::map<String, DynamicLibrary*> DynLibMap;
        DynLibMap mLibMap;
    };

    inline uint32 GetLongevity(PluginManagerImpl*) { return SLT_PLUGIN_MGR; };
    
    typedef Loki::SingletonHolder< PluginManagerImpl,
                                   Loki::CreateUsingNew,
                                   Loki::SingletonWithLongevity
                                 > PluginManager;
} // namespace Abx

#endif // _Abx_PluginManager_hpp_
